Repository navigation
Conversation
The batch size was clamped by the file-level row count. A file that leaves that count at zero, such as repeated_no_annotation.parquet, was read as empty. The clamp now uses the rows the row groups declare. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
ParquetRecordBatchReaderyields no rows forrepeated_no_annotation.parquet(file-levelnum_rowsof 0) #12496.Rationale for this change
The Arrow reader clamps its batch size by
FileMetaData.num_rows.parquet-testing/data/repeated_no_annotation.parquethas that count at 0 and six rows in its row group, so the batch size becomes 0 andParquetRecordBatchReaderreturns no rows and no error. The record API and pyarrow read six rows.What changes are included in this PR?
Both clamps, in
ArrowReaderBuilder::with_batch_sizeand inParquetRecordBatchReaderBuilder::build, use the number of rows the row groups declare. The clamp is there to avoid a large allocation for a small file, and the row groups are what the reader decodes.Are these changes tested?
Yes.
test_file_row_count_of_zeroreadsrepeated_no_annotation.parquetwith the default batch size and with an explicit one, and expects six rows. Onmainit gets zero.Are there any significant user-facing changes?
A file whose file-level row count is lower than the total of its row groups now returns batches of the requested size, and all of its rows when that count is zero.
AI usage disclosure
Claude Code found the problem while fuzzing the reader with corrupted files, and generated the fix, the test and this description. The test was run on
mainwith and without the fix.🤖 Generated with Claude Code